<div id="pageoptions">
    <% @links =""
        if params[:relationship_id] then
           @links += link_to "< back to shared story list", {# link_to options
                        :controller => 'story',
                        :action => 'shared_stories',
                        :relationship_id => params[:relationship_id]} 
        else 
           @links += link_to "< back to shared story list", {# link_to options
                        :controller => 'story',
                        :action => 'shared_stories'} 
        end %>
    <%= @links %>
</div>
<div class="pagination">
    <% if @word_pages.length > 1 then  %>
        <%= if !@word_pages.current.first? then link_to "&lt; Prev", :page=>@word_pages.current.previous else "&lt; Prev" end  %>
        <%= pagination_links(@word_pages) %>
        <%= if !@word_pages.current.last? then link_to "Next &gt;", :page=>@word_pages.current.next else "Next &gt;" end %>
    <% end %>
</div>
<div class="sectionwrap">
    <% if @story %>
        <div class="sectiontitle">
        View <%= link_to "#{@story.title}", {# link_to options
                :controller => 'story',
                :action => 'view',
                :id => @story.id,
                :relationship_id => params[:relationship_id] } %></div>
        <div class="storydates">Created: <%= h(@story.created_at.strftime(" %m/%d/%Y %I:%M%p")) %>  <%= if @story.updated_at then 
                                                                                                                    "Modified: #{h(@story.updated_at.strftime(' %m/%d/%Y %I:%M%p'))}"
                                                                                                                end %></div>
    <% end %>
    <div class="sectionlinks">
        <ul>
            <% if params[:relationship_id] %>
                <% if @story %>
                    <li><%= link_to "study shared words from #{@story.title}", {# link_to options
                    :controller => 'word',
                    :action => 'study_shared_words',
                    :relationship_id => params[:relationship_id],
                    :story_id => @story.id} %></li>
                <% else %>
                    <li><%= link_to "study shared words", {# link_to options
                        :controller => 'word',
                        :action => 'study_shared_words',
                        :relationship_id => params[:relationship_id]} %></li>
                <% end%>
            <% else %>
                <li><%= link_to "study all shared words", {# link_to options
                    :controller => 'word',
                    :action => 'study_shared_words'} %></li>
            <% end %>
        </ul>
    </div>
    <div class="wordlist">
        <% for word in @words %>
            <div class="oneword">
            <% if @story %>
                <%= link_to "#{word.word.chomp}", {# link_to options
                    :controller => 'word',
                    :action => 'view',
                    :relationship_id => params[:relationship_id],
                    :shared => true,
                    :word => word.word,
                    :story_id => @story.id } %>
            <% else %>
                <%= link_to "#{word.word.chomp}", {# link_to options
                    :controller => 'word',
                    :action => 'view',
                    :relationship_id => params[:relationship_id],
                    :shared => true,
                    :word => word.word } %>
            <% end %></div>
        <% end %>
    </div>
</div>